<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateDistributeTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('distribute', function (Blueprint $table) {
            $table->engine = 'InnoDB';
            $table->charset = 'utf8';
            $table->collation = 'utf8_general_ci';
            $table->increments('id');
            $table->integer('vuls_id')->comment('漏洞id');
            $table->integer('app_id')->comment('应用id');
            $table->integer('users_id')->comment('用户id');
            $table->string('name',225)->comment('用户名称')->nullable();
            $table->integer('deadline')->comment('有效时间')->nullable();
            $table->string('link',225)->comment('链接，扩展字段')->nullable();
            $table->integer('source')->default(1)->comment('来源：1，分发，2，转发');
            $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
            $table->timestamp('updated_at')->nullable();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('distribute');
    }
}
